import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { TetrisService } from './tetris.service';
import { CreateTetriDto } from './dto/create-tetri.dto';
import { UpdateTetriDto } from './dto/update-tetri.dto';
import { Tetri } from './entities/tetri.entity';
import { Public } from 'src/common/decorators/public.decorator';

@Controller('tetris')
export class TetrisController {
  constructor(private readonly tetrisService: TetrisService) {}

  @Post('save')
  @Public()
  create(@Body() createTetriDto: Tetri) {
    return this.tetrisService.create(createTetriDto);
  }

  @Get('list')
  @Public()
  findTop10() {
    return this.tetrisService.findTop10();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.tetrisService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateTetriDto: UpdateTetriDto) {
    return this.tetrisService.update(+id, updateTetriDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.tetrisService.remove(+id);
  }
}
